package com.lin.fengxiu.bo;

import com.lin.fengxiu.dto.SkuInfoDTO;
import com.lin.fengxiu.model.Sku;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

/**
 * @ClassName SkuOrderBO
 * @Description TODO 订单业务层模型——Sku信息
 * @Author wushaopei
 * @Date 2021/4/3 22:18
 * @Version 1.0
 */
@Setter
@Getter
public class SkuOrderBO {
    private BigDecimal actualPrice;
    private Integer count;
    private Long categoryId;

    public SkuOrderBO(Sku sku , SkuInfoDTO skuInfoDTO){
        this.actualPrice = sku.getActualPrice();
        this.count = skuInfoDTO.getCount();
        this.categoryId = sku.getCategoryId();
    }

    public BigDecimal getTotalPrice(){
        return this.actualPrice.multiply(new BigDecimal(this.count));
    }
}
